import React, { Component } from "react";
//import logo from "./logo.svg";
// import "./App.css";

class Like extends Component {
  constructor(props) {
    super(props);
    this.state = { data: "" };
  }

  fecthData() {
    fetch("http://localhost:9000/testApi")
      .then((res) => res.text())
      .then((res) => this.setState({ data: res }));
  }

  componentWillMount() {
    this.fecthData();
  }

  render() {
    return (
      <div>
        <header>Learn React,{this.state.data}</header>
      </div>
    );
  }
}

export default Like;
